package org.jeecg.enums.meter;

/**
 * (对电表充值状态  1：充值中 ，  2：已充值成功  ， 3：已充值失败)
 */
public enum MeterChargeStatusEnum {

    METER_CHARGE_STATUS_ING(1, "充值中"),
    METER_CHARGE_STATUS_OK(2, "充值成功"),
    METER_CHARGE_STATUS_ERROR(3, "失败");

    private Integer code;
    private String desc;

    MeterChargeStatusEnum(Integer code, String desc) {
        this.code = code;
        this.desc = desc;
    }

    public Integer getCode() {
        return code;
    }

    public String getDesc() {
        return desc;
    }


    public static String getDesc(Integer value) {
        MeterChargeStatusEnum[] enums = values();
        for (MeterChargeStatusEnum typeEnum : enums) {
            if (value.intValue() == typeEnum.getCode().intValue()) {
                return typeEnum.desc;
            }
        }
        return "";
    }

    public static Integer getValue(String desc) {
        MeterChargeStatusEnum[] enums = values();
        for (MeterChargeStatusEnum typeEnum : enums) {
            if (typeEnum.getDesc().equals(desc)) {
                return typeEnum.code;
            }
        }
        return null;
    }

}
